﻿
using DevTeam;
using System;
using System.Data;

namespace Fatura
{
    public partial class AppSession : Session
    {
        public static int SirketId = 0;
        
        public static string BarkodEkle;
        public static string ScannerDeviceId;
        
        public static DataSet Lookups
        {
            get
            {
                return RepositoryManager.dsLookups ; //as MyData;
            }
        }

        public AppSession()
        {
            RepositoryManager.dsLookups = new DataSet();

            RepositoryManager.dsLookups.Tables.Add("LookUp");
            RepositoryManager.dsLookups.Tables["LookUp"].SetPK2("LookUpId");

            RepositoryManager.dsLookups.Tables.Add("Settings");
            RepositoryManager.dsLookups.Tables["Settings"].SetPK("Name");
            
            RepositoryManager.dsLookups.Tables.Add("DeletedRows");
            RepositoryManager.dsLookups.Tables["DeletedRows"].SetPK2("DeletedRowsId");

            
            Session.GetLookUpUpdatesSP = "FT_GetUpdates";
            Session.GetDeletedRowsSp = "FT_GetDeletedRows";
            Session.GetLookupColumnsSp = "FT_GetLookUps";
            Session.GetLookupMapSp = "FT_GetLookupMap";

            repositoryManager = new RepositoryManager();
            repositoryManager.Mapping += repositoryManager_Mapping;
            repositoryManager.Initialize();
        }

        XForm x = new XForm();

        void repositoryManager_Mapping(DevExpress.XtraGrid.Columns.GridColumn col)
        {
            x.MapGridColumn(col);
        }
    }
}